#include("../../comm/FormHead.html")
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title" style="width: 100%;float:left">
        <li class="layui-this"><i class="layui-icon layui-icon-tabs"></i> #(form.actions=='EDIT'?'编辑':'添加一级')菜单</li>
        #if(form.actions=='EDIT')
        <li lay-event="SetMenuRole"><i class="layui-icon layui-icon-user"></i> 权限角色</li>
        <li lay-event="SetMenuUser"><i class="layui-icon layui-icon-username"></i> 权限人员</li>
        #end if
    </ul>
</div>
<div id="main">
    <div class="layui-row" style="padding-bottom:5px"></div>
    <form action="" class="layui-form margin-10" lay-filter="form">
        <input type="hidden" id="actions" name="actions" value="#(form.actions)">
        <input type="hidden" id="data_img1" name="data_img1" value="#(menu.data_img1)">
        <input type="hidden" id="menu_grade" name="menu_grade" value="1">
        #(token??)

        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单ID</label>

                    <div class="layui-input-block">
                        <input type="text" readonly name="menu_id" id="menu_id"
                               placeholder="自动生成" value="#(menu.menu_id)" class="layui-input input-readonly">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单名称</label>

                    <div class="layui-input-block">
                        <input type="text" name="menu_name" placeholder="请输入菜单名称"
                               lay-affix="clear" lay-verify="required" value="#(menu.menu_name)" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">显示顺序</label>

                    <div class="layui-input-inline" style="width:80px">
                        <input lay-skin="mynumber" type="text" name="sindex" min="0" lay-verify="required"
                               value="#(menu.sindex)" class="layui-input">
                    </div>
                    <label class="layui-form-mid">图标</label>

                    <div class="layui-input-inline width80">
                        <input type="text" lay-skin="myicon" name="menu_icon" value="#(menu.menu_icon)" class="layui-hide">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-md12">
                <div class="layui-form-item">
                    <label class="layui-form-label">菜单备注</label>

                    <div class="layui-input-block">
                        <textarea name="menu_desc" placeholder="请输入菜单备注" class="layui-textarea" style="min-height:120px">#(menu.menu_desc)</textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="Submit1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<SCRIPT LANGUAGE="JavaScript">
    <!--
    var $ = layui.$;
    layui.use('laydate', function () {
        layui.laydate.render({
            elem: '#not_time', type: 'datetime', format: 'yyyy-MM-dd HH:mm'
        });
    });
    layui.use(['form', 'myTool', 'myIcon', 'myNumber', 'util'], function () {
        var form = layui.form;
        layui.myIcon.render({});
        layui.myNumber.render({});

        layui.util.event("lay-event", {
            SetMenuRole: function () {
                location.href = "SetMenuRole?menu_id=" + $("#menu_id").val();
            },
            SetMenuUser: function () {
                location.href = "SetMenuUser?menu_id=" + $("#menu_id").val();
            }
        });


        form.on('select(menutype)', function (obj) {
            if (obj.value == 1) {
                layui.$("#pmenu_title").hide();
                layui.$("#pmenu_select").hide();
            } else {
                layui.$("#pmenu_title").show();
                layui.$("#pmenu_select").show();
            }
        });

        form.on('submit(Submit1)', function (data) {
            layui.myTool.post("ModifySysMenuApi", {postdata: JSON.stringify(data.field)}, function () {
                parent.layer.closeAll();
            });
            return false;
        });
    });
    //-->
</SCRIPT>
</body>
</html>